﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;

namespace aspZone.Commerce.Web.App.Models.Shared
{
    public class CategoryMenu
    {
        private IList<CategoryMenuItem> categories;

        public CategoryMenu(IList<aspZone.Commerce.Model.Category> categories)
        {
            this.categories = new List<CategoryMenuItem>();
            if (categories != null)
            {
                foreach (var category in categories)
                {
                    this.categories.Add(new CategoryMenuItem(category));
                }
            }
        }

        public IList<CategoryMenuItem> Categories(int? currentCategoryId)
        {
            foreach (var category in this.categories)
            {
                category.CurrentCategoryId = currentCategoryId ?? 0;
            }
            return this.categories;
        }
    }
}
